package com.wondream.myframework.app.common.config.datasource;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author wondream
 * @version 1.0
 * @create 2022/11/10 11:54 PM
 */
@NoArgsConstructor
@Data
public class DynamicDataSourceHolder2 {

    private static final ThreadLocal<String> holder = new ThreadLocal<>();

    private static String globalDefaultDataSource = null;

    public static void put(String dataSourceName){
        holder.set(dataSourceName);
    }

    public static String get(){
        return (String)holder.get();
    }

    public static void remove(){
        holder.remove();
    }

    public static String getCurrent() {
        return get();
    }
}

